<?php

class FacebookConnectorController extends Zend_Controller_Action {

	function indexAction() {
		$fbc = new FacebookConnector();
		$this->view->myName = $fbc->whoami();
		$this->view->friends = $fbc->fetchAllFriends();
		$this->view->userId = $fbc->getId();
		$this->view->loginUrl = $fbc->getLoginUrl();
	}
	
	function afficherlisteAction() {
		// Affiche tous les membres
		$fbc = new FacebookConnector();
		
		$links = array();
		foreach($fbc->fetchAllLinks($_GET['friendId']) as $link) {
			$arr = array();
			
			$arr['name'] = $link['name'];
			$arr['url'] = $link['url'];
			
			$shop = new Shop($link['name'], 3);
			$arr['articles'] =  $shop->fetchAll();
			
			$links[] = $arr;
		}
		$this->view->links = $links;
		$this->view->name = $_GET['name'];
	}
}

